/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bo;

import entidades.Disciplina;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Ricardo
 */
public class DisciplinaBO extends BaseBO<Disciplina> {
    private static DisciplinaBO instancia;
    private static List<Disciplina> listaDisciplina = null;
    
    public void carregaDisciplinas (List<Disciplina> disciplinas){
        if(disciplinas != null)
            listaDisciplina = disciplinas;
    }
    
    public static DisciplinaBO getInstance() {
        if(instancia == null) {
            instancia = new DisciplinaBO();
            listaDisciplina = new ArrayList<Disciplina>();
	}
	return instancia;
    }

    @Override
    public void criar(Disciplina disciplina) throws Exception {
        listaDisciplina.add(disciplina);
    }

    @Override
    public void alterar(int id, Disciplina disciplina) throws Exception {
	listaDisciplina.set(id, disciplina);
    }

    @Override
    public void excluir(int id) throws Exception {
        listaDisciplina.remove(id);
    }

    @Override
    public List<Disciplina> listar() throws Exception {
	return listaDisciplina;
    }
}
